package com.blb.day20231102springboot.controller;

import com.blb.day20231102springboot.pojo.Student;
import com.blb.day20231102springboot.pojo.StudentConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    //注入值
    @Value("${server.port}")
    private Integer port;

    @Autowired
//    private Student student;
    private StudentConfig student;

    @RequestMapping("hello")
    public String hello(){
        return "Hello SpringBoot123456";
    }

    @RequestMapping("showConfig")
    public String showConfig(){
        return "port:" + port;
    }

    @RequestMapping("showStudent")
    public String showStudent(){
        return student.toString();
    }
}
